<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <p id="child">hello world</p>
    <script>
        /* 
        parentNode.replaceChild(newElement,oldElement)
         */
        var child= document.getElementById("child");
        var h1 =document.createElement("h1");//创造一个元素
        h1.innerHTML="lalala";
        document.body.replaceChild(h1,child);//替换元素
    </script>
</body>
</html>